﻿using System;
using System.Collections.Generic;
using System.Text;

namespace 继承测试_MM路径
{
	class Month:CalendarUnit
	{
		private Year m_year;
		private int[] daysList = {31,28,31,30,31,30,31,31,30,31,30,31};

		public Month(int pos, Year year)
		{
			SetMonth(pos, year);//msg18
		}

		public void SetMonth(int pos, Year year)
		{
			SetCurrentPos(pos);//msg19
			m_year = year;
		}

		public int GetMonth()
		{
			return m_currentPos;
		}

		public int GetMonthSize()
		{
			if(m_year.IsLeap())
			{
				daysList[1] = 29;//msg20
			}
			else
			{
				daysList[1] = 28;
			}

			return daysList[m_currentPos - 1];
		}

		public override bool Increment()
		{
			bool result = false;
			m_currentPos += 1;
			if(m_currentPos>12)
			{
				result = false;
			}
			else
			{
				result = true;
			}
			return result;
		}
	}
}
